<%-- 
    Document   : create
    Created on : 2015-2-10, 16:36:40
    Author     : ppc
--%>

<%@page contentType="text/html; charset=UTF-8" session="false" %>
<%@include  file="/WEB-INF/jspf/import.jspf"%>
<!DOCTYPE html>
<style>
    .divLeft {display: inline-block;width:550px;height:400px;padding:10px 10px 20px 5px; border:  #000 dashed 1px; margin:10px 10px 0 10px}
    .divLeft dl{ float: left;line-height: 15px;display: inline-flex;width:600px; height: auto;vertical-align:middle; padding: 5px 0 5px 0}
    .divLeft dd{display: inline-block; padding-right: 15px; width:360px}
    .divLeft dt{display: inline-block;line-height: 23px; width:300px;text-align: left;padding-left: 30px;}
    b {margin-top: 20px; display: inline-block}
    .divTitle{float:left;width:50%;}
</style>
<div>
    <form action="${ROOT}/admin/brand/club/${empty o?"create":"update"}.do" method="post"  class="pageForm required-validate" onsubmit="return check(this, navTabAjaxDone);">
        <input type="hidden" name="provinceName" id="provinceName" value="${o.provinceName}"/>
        <input type="hidden" name="cityName"  id="cityName" value="${o.cityName}"/>
        <input type="hidden" name="brandName" id="brandName" value="${o.brandName}"/>
        <input type="hidden" name="seriesName" id="seriesName" value="${o.seriesName}"/>
        <input type="hidden" name="oClubId" value="${o.oClubId}"/>
        <div>
            <div class="divTitle"><b style="padding:0 0 0 30px">品牌车友会信息;</b></div>
            <div class="divTitle"><b>商家信息:</b></div>
        </div>
        <div>
            <div class="divLeft"> 
                <dl class="dlLeft">
                    <dt>品牌车友会名称：</dt>
                    <dd> <input type="text" name="name" class="required" value="${fn:escapeXml(o.name)}" <c:if test="${not empty o}">readonly</c:if>/></dd>
                </dl>
                <dl class="dlLeft">
                    <dt>个性化域名： http://club.pcauto.com.cn/brand/</dt>
                    <dd><input type="text" name="url" class="required" value="${fn:escapeXml(o.url)}" <c:if test="${not empty o}">readonly</c:if>/></dd>
                </dl>
                <dl class="dlLeft">
                    <dt>地区：</dt>
                    <dd> <select id="areaParentTag_cityId" name="provinceId"></select><select id="cityId" name="cityId"></select></dd>
                </dl>
                <dl class="dlLeft">
                    <dt>品牌：</dt>
                    <dd> <select id="brandId" style="width:120px" name="brandId"><option value="0">请选择</option></select><select id="seriesId" style="width:100px" name="seriesId"><option value="0">请选择</option></select></dd>
                </dl>
                <dl class="dlLeft">
                    <dt class="required">分类：</dt>
                    <dd>  <select name="type">
                        <c:forEach items="${tags}" var = "t">
                            <option value="${t.tagId}">${t.tagName}</option>
                        </c:forEach>
                        </select></dd>
                </dl>
                <dl class="dlLeft">
                    <dt>关联论坛ID：</dt>
                    <dd> <input type="text" name="forumId" class="required" value="${o.forumId}" <c:if test="${not empty o}">readonly</c:if>/></dd>
                </dl>
                <dl class="dlLeft">
                    <dt>需要验证手机号码：</dt>
                    <dd> <input type="radio" name="isbind" class="required" value="1" ${(empty o || o.bindPhone==1)?"checked":""} style="vertical-align: -3px;"/> 需要
                            &nbsp;&nbsp;
                            <input type="radio" name="isbind" class="required" value="0" ${o.bindPhone==0?'checked':''}  style="vertical-align: -3px;"/> 不需要
                    </dd>
                </dl>
                <dl class="dlLeft">
                    <dt>状态：</dt>
                    <dd> <select name="status">
                            <option value="0" ${o.status==0?"selected":""}>未发布</option>
                            <option value="1" ${o.status==1?"selected":""}>发布</option>
                        </select></dd>
                </dl>
                <dl class="dlLeft">
                    <dt>简介：</dt>
                    <dd> <textarea type="text" name="intr"  rows="7" cols="40" >${fn:escapeXml(o.introduce)}</textarea></dd>
                </dl>
            </div><div class="divLeft">
                <dl class="dlLeft">
                    <dt>商家信息：</dt>
                    <dd> <input type="text" name="business" class="required" value="${fn:escapeXml(contact.business)}"/></dd>
                </dl>
                <dl class="dlLeft">
                    <dt>联系人：</dt>
                    <dd> <input type="text" name="businessName" value="${fn:escapeXml(contact.name)}"/></dd>
                </dl>
                <dl class="dlLeft">
                    <dt>联系方式：</dt>
                    <dd> <input type="text" name="phone" value="${fn:escapeXml(contact.phone)}"/></dd>
                </dl>
                <dl class="dlLeft">
                    <dt>邮箱</dt>
                    <dd> <input type="text" name="email" value="${fn:escapeXml(contact.email)}"/></dd>
                </dl>
                 <dl class="dlLeft">
                    <dt>QQ</dt>
                    <dd> <input type="text" name="qq" value="${fn:escapeXml(contact.qq)}"/></dd>
                </dl>
                <dl class="dlLeft">
                    <dt>公司地址：</dt>
                    <dd> <input type="text" name="address" value="${fn:escapeXml(contact.address)}"/></dd>
                </dl>
                <dl class="dlLeft">
                    <dt>备注：</dt>
                    <dd> <textarea type="text" name="remark" rows="7" cols="40" >${fn:escapeXml(contact.remark)}</textarea></dd>
                </dl>
            </div>
        </div>
        <div class="formBar">
            <ul>
                <li><div class="buttonActive"><div class="buttonContent"><button type="submit">保存</button></div></div></li>
                <li><div class="button"><div class="buttonContent"><button class="close" type="button">关闭</button></div></div></li>
            </ul>
        </div>
    </form>
</div>
<script>
    //车友会地区
$.getScript("${UCROOT}/intf/area.jsp?tag=cityId&selected=${empty o && o.cityId>0?0:o.cityId}&defaultCityTips=0");
jQuery.getScript("${ROOT}/js/brand_series.js",function(){
    //车系
    relatedSelect(
    {id:"brandId",url:"http://price.pcauto.com.cn/interface/5_3/brand_json_chooser_v2.jsp?_t=" + new Date().getTime(),node:{root:"brands", value:"id", text:"text",custom:"id"},load:true<c:if test="${o.brandId>0}">,defaultValue:${o.brandId}</c:if>},
    {id:"seriesId",url:"http://price.pcauto.com.cn/interface/5_3/serial_json_chooser.jsp?brand=",node:{root:"firms", value:"id", text:"text",custom:"id"}<c:if test="${o.seriesId>0}">,defaultValue:${o.seriesId}</c:if>});
    
    $("#brandId").change(function(){
        var selectText = $(this).find("option:selected").text();
        $("#brandName").val(selectText); 
        //选完品牌要清车系
        $("#seriesName").val("");
    });
    $("#seriesId").change(function(){
        
        var selectText = $(this).find("option:selected").text();
        $("#seriesName").val(selectText); 
    });
});
function setProvinceCity(){
    //提交前设置省份
        var $provinceOption = $("#areaParentTag_cityId").find("option:selected");
        if($provinceOption.length>0 && $provinceOption.val()!=""){
            $("#provinceName").val($provinceOption.text());
        }else{
            $("#provinceName").val("");
        }
        var $cityOption = $("#cityId").find("option:selected");
        if($cityOption.length>0 && $cityOption.val()!="0" && $cityOption.text()!='请选择地区'){
            var cityText = $cityOption.text();
            $("#cityName").val(cityText);
        }else{
            $("#cityName").val("");
        }
}
function check(frm,navTabAjaxDone){
    setProvinceCity();
    if (!validateCallback(frm, navTabAjaxDone)) {
		return false;
	}
        return false;
}
</script>
